close all;
clear;

comFileDir = pwd;
comFileDir = strrep(comFileDir,'\','\\');
comFileDir = strcat(comFileDir,'\\Data');
noCam = 6;

for iNoCam = 1:noCam
    fileDir = strcat(comFileDir,'\\K',sprintf('%d',iNoCam),'\\');
    fileDirCopy = strcat(comFileDir,'\\arctic',sprintf('%d',iNoCam),'\\');
    seq(iNoCam).data = dir([fileDir,'*.jpg']);
    seq(iNoCam).size = size(seq(iNoCam).data,1);
    %     pointIdx = 1:STEP4STAT:;
    %     disp('Flip frame...     ');
    numFrame = seq(iNoCam).size;
    fprintf('Camera %d ',iNoCam);
    disp('Flip frame...     ');
    for iNumFrame = 1:numFrame
        IM = imread([fileDir,seq(iNoCam).data(iNumFrame).name]);
        FLIPIM = flipdim(IM,2);        
        imwrite(FLIPIM,[fileDirCopy,seq(iNoCam).data(iNumFrame).name]);
        fprintf(1,'\b\b\b\b\b\b %5d',iNumFrame);
    end
    fprintf('\n');
end


%
% % add path to config data
% addpath ../../CommonCfgAndIO
%
% config = configdata(expname(),'im2points');
%
% im.dir = config.paths.img;
% im.ext = config.files.imgext;
%
% NoCams = size(config.files.idxcams,2);	% number of cameras
%
% STEP4STAT = 1; % step for computing average and std images, if 1 then all images taken
%
% % load image names
% for i=1:NoCams,
%   seq(i).camId = config.files.idxcams(i);
%   if seq(i).camId > -1
% 	if findstr(config.expname,'oscar')
% 	  seq(i).data = dir([sprintf(im.dir,seq(i).camId),config.files.imnames,'*.',im.ext]);
% 	else
% 	  seq(i).data = dir([sprintf(im.dir,seq(i).camId),sprintf(config.files.imnames,seq(i).camId),im.ext]);
% 	end
%   else
% 	seq(i).data = dir([im.dir,sprintf(config.files.imnames),im.ext]);
%   end
%   seq(i).size = size(seq(i).data,1);
%   if seq(i).size<4
% 	error('Not enough images found. Wrong image path or name pattern?');
%   end
% end
%
% for i=1:NoCams,
%     pointIdx = 1:STEP4STAT:seq(i).size;
%     disp('Flip frame...     ');
% 	for j=pointIdx,
% 	  IM = imread([sprintf(im.dir,seq(i).camId),seq(i).data(j).name]);
% 	  %avIM = avIM + double(IM);
%       FLIPIM = flipdim(IM,2);
%       imwrite(FLIPIM,[sprintf(im.dir,seq(i).camId),seq(i).data(j).name]);
%       fprintf(1,'\b\b\b\b\b\b %5d',j);
%     end
% end